﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using WeifenLuo.WinFormsUI.Docking;
using System.Runtime.InteropServices;
//using _180FrameWork.Common;

namespace _180FrameWork.CustControls
{
    public partial class frmBase : DockContent
    {
        public frmBase()
        {
            InitializeComponent();
        }

        //解决输入法BUG   
        [DllImport("imm32.dll")]
        public static extern IntPtr ImmGetContext(IntPtr hwnd);
        [DllImport("imm32.dll")]
        public static extern bool ImmSetOpenStatus(IntPtr himc, bool b);

        protected override void OnActivated(EventArgs e)
        {
            base.OnActivated(e);
            IntPtr HIme = ImmGetContext(this.Handle);
            ImmSetOpenStatus(HIme, true);
        }

        //protected void SoundSuccess()
        //{
        //    SoundHelper.SoundSuccess();
        //}

        //protected void SoundError()
        //{
        //    SoundHelper.SoundError();
        //}

        //protected void Speak(string text)
        //{
        //    SoundHelper.Speak(text);
        //}

        public void Alert(string strMessage)
        {
            MessageBox.Show(strMessage, "提示", MessageBoxButtons.OK, MessageBoxIcon.Information, MessageBoxDefaultButton.Button1, 0);
        }

        public bool Confirm(string strQuestion)
        {
            if (MessageBox.Show(strQuestion, "提问", MessageBoxButtons.YesNo, MessageBoxIcon.Question, MessageBoxDefaultButton.Button1, 0) == DialogResult.Yes)
                return true;
            else
                return false;
        }

        private void frmBase_FormClosing(object sender, FormClosingEventArgs e)
        {

        }

        private void frmBase_Load(object sender, EventArgs e)
        {

        }

        public string MenuID { get; set; }
    }
}
